Shader "Unlit/wxy_transparent开启深度写入"
{
    Properties
    {
       _MainTex("MainTex", 2D) = ""{}
       _AlphaScale("AlphaScale", Range(0,1)) = 1
    }
    SubShader
    {
        Tags{ "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
        Pass
        {
            //开启深度写入
            ZWrite On
            //忽略颜色
            ColorMask 0
            
        }
        Pass
        {
            Tags{ "LightMode" = "ForwardBase" }
//            Tags{ "LightMode" = "Vertex" }
            ZWrite Off
            Blend SrcAlpha OneMinusSrcAlpha

            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"
            #include "Lighting.cginc"

            sampler2D _MainTex;
            float4 _MainTex_ST;
            fixed _AlphaScale;

            struct v2f
            {
                float4 pos:SV_POSITION;
                float2 uv:TEXCOORD0;
            };

            v2f vert (appdata_base v)
            {
               v2f data;
               data.pos = UnityObjectToClipPos(v.vertex);
               data.uv = v.texcoord.xy * _MainTex_ST.xy + _MainTex_ST.zw;
               return data;
            }

            fixed4 frag (v2f i) : SV_Target
            {
                fixed4 texColor = tex2D(_MainTex, i.uv);
                return fixed4(texColor.rgb, texColor.a * _AlphaScale);
            }
            ENDCG
        }
    }
}
